package com.vito.dcs.water.waterAlarm.action;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.dubbo.config.annotation.Reference;
import com.vito.base.authoriza.action.BaseAction;
import com.vito.base.authoriza.cache.SessionMap;
import com.vito.base.authoriza.model.UserModel;
import com.vito.base.model.ResMsg;
import com.vito.base.model.Result;
import com.vito.dcs.water.waterAlarm.model.WaterAlarmModel;
import com.vito.dcs.water.waterAlarm.service.WaterAlarmService;

/**
 * 报警监控
 * @author lyhao
 *
 */
@Controller
@RequestMapping("/dcs/water/waterAlarm")
public final class WaterAlarmAction extends BaseAction {
	
	private static final Logger log = LoggerFactory.getLogger(WaterAlarmAction.class);
	
	@Reference
	private WaterAlarmService waterAlarmService;
	
	/**
	 * 分页查询
	 * @param waterAlarmModel
	 * @return
	 */
	@RequestMapping("queryWaterAlarmByPage")
	@ResponseBody
	public Result queryWaterAlarmByPage(WaterAlarmModel waterAlarmModel){
		Result res = new Result();
        UserModel user =SessionMap.getObj();
        if(null==user){
            res.setCode(Result.CODE_LOGIN_REQUIRE);
            res.setMsg(ResMsg.MSG_LOGIN_NEED);
            return res;
        }
		try{
			res.setData(waterAlarmService.queryWaterAlarmByPage(waterAlarmModel));
			res.setCode(Result.CODE_OK);
		}catch(Exception ex){
			log.error("查询失败",ex);
			res.setCode(Result.CODE_ERROR);
			res.setMsg(ResMsg.EXECERR);
		}
		return res;
	}
	
}



